package com.qfedu.service.impl;

import com.qfedu.dao.UserDao;
import com.qfedu.dao.impl.UserDaoImpl;
import com.qfedu.pojo.User;
import com.qfedu.service.UserService;

/**
 *
 * dao   data access object
 * 创建者: QF-SUN
 * 创建时间: 2023/3/31 16:11
 * 描述:
 */
public class UserServiceImpl implements UserService {
    UserDao dao = new UserDaoImpl();
    @Override
    public boolean checkUsername(String username) {
        long count = dao.selectCountByUsername(username);
        return count !=0 ;
    }

    @Override
    public boolean register(String username, String password, String email, String gender) {
        return  dao.insert(username, password, email, gender);
    }

    @Override
    public User login(String username, String password) {
        return dao.selectByUsernameAndPwd(username , password, 1);
    }
}
